<?php
namespace core\proxy;

/**
 * 会员代理模式
 */
use core\Factory;

class UserProxy implements IUserProxy
{

    function setUserName(int $id, string $name)
    {
        $db = Factory::getDatabase('slave');
        $db->query("update user set name = '{$name}' where id = {$id} limit 1");
    }

    function getUserName(int $id)
    {
        $db = Factory::getDatabase('master');
        $db->query("select name from user where id = {$id} limit 1");
    }
}